package com.example.ctrip.commons;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Service("common")
@Component
public class Commons {
//
    private static final String IMGCODE = "C:/imgtest/";
    private static final String OPENCVDLL = "C:/workspace/jdk1.8.0_32bit/bin/opencv_java2410.dll";
    private static final String WEBDRIVER = "C:/workspace/chromedriver.exe";
//
//        private static final String IMGCODE = "F:/imgtest/";
//        private static final String OPENCVDLL = "F:/java/jdk/bin/opencv_java2410.dll";
//        private static final String WEBDRIVER = "F:/chromedriver.exe";

    public static String getWEBDRIVER() {
        return WEBDRIVER;
    }

    public static String getIMGCODE() {
        return IMGCODE;
    }

    public static String getOPENCVDLL() {
        return OPENCVDLL;
    }

    /**
     * 获取精确到秒的当前时间戳
     *
     * @return int
     */
    public int getNowSecondTimestamp() {
        String timestamp = String.valueOf(System.currentTimeMillis());
        int length = timestamp.length();
        if (length > 3) {
            return Integer.parseInt(timestamp.substring(0, length - 3));
        } else {
            return 0;
        }
    }
}
